/**
 * 模态框
 */
module.exports = function($scope, $state, $stateParams, $modalInstance, $resource,items){

    var param = {
        'id': items.id,
        'statusCode': '2',
    }
    $resource('/api/ac/sc/systemFunction/setAuthType', {}, {}).save(param, function (res) {
        if (res.errcode === 0) {
            $scope.a = res.data.a;
            $scope.u = res.data.u;
        } else {
            alert(res.errmsg);
        }
    });

    $scope.ok = function () {
        var admin = $scope.a?'1':'0';
        var user = $scope.u?'1':'0';
        var para = {
            'id' : items.id,
            'a' : admin,
            'u' : user
        };
        $resource('/api/ac/sc/systemFunction/setAuthType', {}, {}).save(para, function (res) {
            if (res.errcode === 0) {
                console.log('success');
            } else {
                alert(res.errmsg);
            }
		});
        //关闭模态框
        $modalInstance.close();
       
    };

    $scope.cancel = function () {
        $modalInstance.dismiss('cancel');
    };
};